<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/templates/templateLayout.xhtml">

	<f:metadata>
		<f:event type="preRenderView" listener="#{propietarioBean.vermensaje()}" />
	</f:metadata>

	<ui:define name="centerContent">
		<h:panelGroup layout="block"
			class="title ui-widget-header ui-corner-all"
			style="padding: 8px; font-size: 16px !important; text-align: center;">
			<h:outputText value="#{msgs['title.propietario']}" />
			

		<h:form id="formentity">
				<p:messages id="messagesFilter" showDetail="true"  closable="true" showSummary="true"/>
				<p:growl showDetail="true" id="msgGrwl" />	
				<ui:include src="/templates/toolbarSearch.xhtml">
					<ui:param name="bean" value="#{propietarioBean}" />					
				</ui:include>				

				<p:dataTable id="list" var="item" value="#{propietarioBean.list}" widgetVar="entityTable"
					rowKey="#{item.id}" lazy="true" selectionMode="single" 
					selection="#{propietarioBean.entity}" paginator="true"
					resizableColumns="false" rows="10" 
					paginatorPosition="bottom"  filterDelay="1000" emptyMessage="#{msgs['lista.vacia']}"
					sortBy="#{propietarioBean.sortDefault}"  sortMode="multiple"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="10,20,30,50">					
					
					<p:ajax event="rowSelect" listener="#{propietarioBean.onRowSelect}" update=":formentity:msgGrwl" immediate="true"/>
					<p:ajax event="filter" listener="#{propietarioBean.filterListener(':formentity:list')}" update=":formentity:messagesFilter"/>
        
        
					<ui:include src="/pages/shared/commonClienteGrilla.xhtml">
						<ui:param name="item" value="#{item}" />
					</ui:include>
								
					<p:column headerText="#{msgs['form.porcentaje']}" sortBy="#{item.porcentaje}">
						<h:outputText value="#{item.porcentaje}" />
					</p:column>
					<p:column headerText="#{msgs['cant.propiedades']}"	>
						<h:outputText value="#{item.propiedades.size()}" />
					</p:column>
					<p:column width="60">
						<h:link outcome="create" title="Editar">
							<p:graphicImage library="images" name="edit-grid.png" />
							<f:param name="id" value="#{item.id}" />
						</h:link>
						<h:link outcome="view" title="Ver">
							<p:graphicImage library="images" name="view-grid.png" />
							<f:param name="id" value="#{item.id}" />
						</h:link>
						<p:commandLink action="#{propietarioBean.delete(item)}" update=":formentity"
							onstart="return confirm('#{msgs['confirmar.eliminar']}')">
							<p:graphicImage library="images" name="delete-grid.png" />
						</p:commandLink>
						<h:link outcome="/pages/cuenta/view" title="Detalle Cuenta">
							<p:graphicImage library="images" name="cuota.png" />
							<f:param name="id" value="#{item.cuenta.id}" />
						</h:link>
					</p:column>
								
				</p:dataTable>
			</h:form>
		</h:panelGroup>
	</ui:define>
	
</ui:composition>
</html>
